#define _CRT_SECURE_NO_WARNINGS 1



#include<stdio.h>

int fun(int n)
{
	int sum = 0, x = 0;
	while (n)
	{
		x = n % 10;
		sum += x * x * x;
		n /= 10;
	}
	return sum;
}
int main()
{
	int n = 0;
	scanf("%d", &n);
	if (fun(n) == n)
		printf("YES\n");
	else
		printf("NO\n");

	return 0;
}